﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Znice
{
    public partial class FrmTableConfig : Form
    {
        public int rows;
        public int columns;
        public int columnWidth;
        public FrmTableConfig()
        {
            InitializeComponent();
        }

        private void RadioButton_CheckedChanged(object sender, EventArgs e)
        {
            if (sender is RadioButton radioButton && radioButton.Checked)
            {
                numColWidth.ReadOnly = !rbFixed.Checked;
            }
        }

        private void btnSave_Click(object sender, EventArgs e)
        {
            _ = int.TryParse(numRow.Value.ToString(), out rows);
            _ = int.TryParse(numCol.Value.ToString(), out columns);
            _ = int.TryParse(numColWidth.Value.ToString(), out columnWidth);
            if (!rbFixed.Checked)
            {
                columnWidth = 0;
            }
            DialogResult = DialogResult.OK;
        }
    }
}
